<template>
  <div class="wrapper" @click="linkList">
    <img class="user" src="@/assets/normal/appraisal.png" />
    <div class="content">
      <div class="title-wrapper">
        <div class="title van-ellipsis">{{ data.deptName }}</div>
        <div :class="{ status: true, finished: data.status == '已结束' }">{{ data.status }}</div>
      </div>
      <div class="time">{{ data.year }}年</div>
    </div>
  </div>
</template>

<script>
import { Toast } from "vant";
export default {
  props: {
    data: {
      type: Object,
      default: () => {
        return {};
      }
    }
  },
  methods: {
    linkList() {
      // if (this.data.status == "未开始") {
      //   Toast("暂未开始");
      //   return;
      // }
      sessionStorage.setItem("appraisalData", JSON.stringify(this.data));
      this.$router.push({
        path: "/year/appraisalPeriod/list",
        query: {
          id: this.data.id,
          finished: this.data.status == "已结束" ? 1 : 0
        }
      });
    }
  }
};
</script>

<style scoped lang="scss">
.wrapper {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
  background: #fff;
  border-radius: 8px;
  padding: 18px 16px 18px 24px;
  img {
    width: 24px;
    margin-right: 22px;
  }
  .content {
    flex: 1;
    .title-wrapper {
      display: flex;
      align-items: center;
      justify-content: space-between;
    }
    .time {
      color: #a3a7ad;
      line-height: 18px;
      font-size: 13px;
      margin-top: 4px;
    }
    .title {
      max-width: 210px;
      font-size: 14px;
      line-height: 20px;
      color: #333333;
    }
    .status {
      font-size: 12px;
      color: #18cc3a;
      &.finished {
        color: #a3a7ad;
      }
    }
  }
}
</style>
